﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GenericGA.reader.regex
{
    /// <summary>
    /// A regular expression node for an empty list.
    /// </summary>
    /// <typeparam name="A">The type of the alphabet being matched.</typeparam>
    public class Empty<A> : Regex<A>
    {

        /// <summary>
        /// Constructor to create an empty list expression.
        /// </summary>
        public Empty()
        {
        }

        /// <summary>
        /// Generate a list which is matched by the regular expression based on a reader object. In this case, the empty list.
        /// </summary>
        /// <param name="reader">Reader object to determine which list to generate. This regular expression doesn't consume any bits from the reader.</param>
        /// <returns>The empty list.</returns>
        public override List<A> Generate(Reader reader)
        {
            return new List<A>();
        }

        /// <summary>
        /// Enumerate every list which matches this regular expression. In this case, the empty list.
        /// </summary>
        /// <returns>An iteration with just an empty list.</returns>
        public override IEnumerable<List<A>> Enumerate()
        {
            yield return new List<A>();
        }

    }
}
